<?php

namespace Models\Validators;

class Required extends ValidatorAbstract {

    protected $_errorMsgPattern = '%s is required';
    
    public function isValid($elementName, $value) {
        if (empty($value)) {
            $this->_buildErrorMessage($elementName);
            return false;
        }
        
        return true;
    }
    
    protected function _buildErrorMessage($elementName) {
        $this->_errorMsg = sprintf($this->_errorMsgPattern, $elementName);
    }
}
    

